<template>
  <view class="page-container">
    <view class="page-title">uni-app</view>
    <view class="input-group">
      <text class="label">输入值:</text>
      <input type="text" v-model="title" class="input red-input" />
    </view>
    <view class="input-group">
      <text class="label">回传值:</text>
      <input type="text" :value="callBackValue" class="input yellow-input" readonly />
    </view>
    <comA :intent="title" class="comp-wrapper" />
    <comB @callBackFun="callBack" class="comp-wrapper" />
  </view>
</template>

<script>
import comA from '../../../components/compA.vue'
import comB from '../../../components/compB.vue'
export default {
  components: { comA, comB },
  data() {
    return {
      title: '',
      callBackValue: ''
    };
  },
  methods: {
    callBack(msg) {
		console.warn("---index---callBack-->"+msg);
      this.callBackValue = msg;
    }
  }
};
</script>

<style scoped>
.page-container {
  padding: 20rpx;
  border: 1rpx solid #ccc;
}
.page-title {
  font-size: 40rpx;
  font-weight: bold;
  text-align: center;
  margin-bottom: 40rpx;
}
.input-group {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}
.label {
  width: 120rpx;
  font-size: 28rpx;
}
.input {
  flex: 1;
  height: 60rpx;
  border: none;
  padding: 0 20rpx;
  font-size: 28rpx;
}
.red-input {
  background-color: #ccc;
  color: red;
}
.yellow-input {
  background-color: #ccc;
  color: yellow;
}
.comp-wrapper {
  margin-bottom: 30rpx;
}
</style>